{% extends 'wxchat/wxbase.html' %}{% load static %}
{% block extra %}
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    wx.config({
        debug: false,
        appId: '{{ sign.appId }}',
        timestamp:'{{ sign.timestamp }}',
        nonceStr: '{{ sign.nonceStr }}',
        signature: '{{ sign.signature }}',
        jsApiList: [
            'startRecord',
            'stopRecord',
            'onVoiceRecordEnd',
            'playVoice',
            'pauseVoice',
            'stopVoice',
            'onVoicePlayEnd',
            'uploadVoice',
            'downloadVoice',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'translateVoice',
            'getNetworkType',
            'openLocation',
            'getLocation',
            'closeWindow',
            'scanQRCode',
            'chooseWXPay',
            'openProductSpecificView',
            'addCard',
            'chooseCard',
            'openCard',
            'onMenuShareAppMessage'
        ]
    });
    wx.ready(function () {
        $('#checkJsApi').on('click',function(){
            wx.checkJsApi({
              jsApiList: [
                'onMenuShareAppMessage',
                  'chooseImage',
                  'openLocation',
              ],
              success: function (res) {
                alert(JSON.stringify(res));
              }
            });
      });

    $('#getNetworkType').on('click',function(){
        wx.getNetworkType({
              success: function (res) {
                alert(res.networkType);
              },
              fail: function (res) {
                alert(JSON.stringify(res));
              }
            });
    });
    $("#scanQRCode0").on('click',function(){
        wx.scanQRCode({
            needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
            scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
            success: function (res) {
                var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                //alert(result)
            }
        });
    })

    $("#scanQRCode1").on('click',function(){
        wx.scanQRCode({
            needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
            scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
            success: function (res) {
                var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                alert(result)
            }
        });
    });

    $("#dog_walk").on('click',function(){
         wx.openLocation({
          latitude: 40.7094,
          longitude: 120.765,
          name: '宠物乐园',
          address: '东砬村(葫芦岛市龙港区双树乡东砬村)',
          scale: 14,
          infoUrl: ''
        });
    });

});
</script>
    <style>
    .btn_size{
        height:100px;line-height: 100px;
        font-size:2em;
        margin-left: 30px;
        margin-right: 30px;
    }
    .btn_size i{
        font-size:1.1em;
        padding-right:1.0em;
    }

    </style>

{% endblock extra%}
{% block container %}
    <div class="weui-btn-area">
        <a class="weui-btn weui-btn_primary"  id="checkJsApi">确定</a>
        <a class="weui-btn weui-btn_primary"  id="getNetworkType">网络状态</a>
        <a class="weui-btn weui-btn_primary"  id="scanQRCode0">二维码0</a>
        <a class="weui-btn weui-btn_primary"  id="scanQRCode1">二维码1</a>

        <a class="weui-btn weui-btn_primary btn_size"   id="dog_walk"><i class="icon iconfont icon-chongwu" ></i>遛狗</a>
        <a class="weui-btn weui-btn_primary btn_size"  id="dog_adoption"><i class="icon iconfont icon-chongwu" ></i>宠物寄养</a>
        <a class="weui-btn weui-btn_primary btn_size"  id="dog_adoption"><i class="icon iconfont icon-chongwu" ></i>宠物洗浴</a>
        <a class="weui-btn weui-btn_primary btn_size"  id="dog_adoption"><i class="icon iconfont icon-chongwu" ></i>宠物保险</a>
    </div>

{% endblock container %}
